fix(review): linked-issue claim priority theft, unscoped PR-mention pollution, hard-rule stickiness, and draft-cycling double-count - #6455
Merged
Conversation
… bugs - resolveLinkedIssueClaimedAt now only resets the claim timestamp when the new linked-issue set has NO overlap with the prior one, instead of resetting on any set change. Previously adding an unrelated issue reference alongside an already-claimed one reset the whole PR's claim time, letting a later PR steal duplicate-cluster winner priority for the originally-claimed issue. - extractLinkedPrNumbers now requires the same closing-keyword adjacency (closes/fixes/resolves) extractLinkedIssueNumbersWithOverflow already enforces, so a bare "PR #N" text mention in an issue body no longer falsely populates linkedPrs and hides an available issue from contributor recommendations. - mergeLinkedIssueHardRuleWithPersistedViolation takes an explicit anyRuleOn flag so a persisted hard-rule violation marker is no longer resurrected once every linkedIssueHardRule has been disabled in config -- previously a PR flagged by a since-disabled rule stayed condemned to close forever. - bumpPullRequestDraftConversionCount is now idempotent per webhook deliveryId, mirroring the existing moderation-violation dedup pattern, so a queue retry of one legitimate draft conversion no longer double-counts toward the repeated-cycling auto-close.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6455 +/- ##
=======================================
Coverage 95.59% 95.59%
=======================================
Files 589 589
Lines 47025 47032 +7
Branches 14951 14953 +2
=======================================
+ Hits 44952 44959 +7
Misses 1291 1291
Partials 782 782
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 4 confirmed adversarial-audit findings in
src/db/repositories.ts(with two small, explicitly-scoped cross-file call-site touches tosrc/queue/processors.tsandsrc/review/linked-issue-hard-rules.ts— see notes below):linkedIssueClaimedAtfor the WHOLE PR, letting a later PR steal duplicate-winner priorityPR #Ntext-mention regex pollutesissue.linkedPrs, hiding fully-available issues from contributor recommendations and marking themdo_not_uselinkedIssueHardRuleViolatedAtis a permanent, never-cleared marker: disabling a hard rule in repo config does not save a PR it already flaggedEach fix follows the audit's own verified failure scenario and root-cause analysis (2-independent-skeptic adversarial verification pass, both had to vote "confirmed").
Notes on implementation choices:
mergeLinkedIssueHardRuleWithPersistedViolation/resolveLinkedIssueHardRule(src/review/linked-issue-hard-rules.ts), not inrepositories.tsitself — the fix threads a newanyRuleOn: booleanparameter rather than inferring intent fromlive's definedness, sinceresolveLinkedIssueHardRulecollapses "no rule on at all" and "rule on but zero linked issues this pass" to the sameundefinedreturn, and only the former should suppress a stale persisted violation.deliveryIdparameter throughbumpPullRequestDraftConversionCount, with a matching one-argument addition at its call site inprocessors.ts.packages/loopover-miner/lib/self-review-context.jshand-maintains a JS mirror ofextractLinkedPrNumbersthat still uses the old unscoped pattern. Flagging for a follow-up issue rather than expanding this PR's blast radius.Closes #6404
Closes #6410
Closes #6411
Closes #6414
Test plan
npx tsc --noEmitclean,npm run build --workspace @loopover/enginecleannpm run test:ci) green